﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <link href="./Public/Admin/Css/public.css" rel="stylesheet" type="text/css"/>
    <script src="./Public/Admin/Js/jquery.js"></script>
    <title>文章管理</title>
    <script>
        function confirmDel(articleId) {
            if (confirm("您确定要删除当前文章吗？")) {
                $.get("?c=Article&a=delete&id=" + articleId, (message) => {
                    $("#tipsMsg").html(message);
                    $("#showMessage").show(500);
                    setTimeout(() => {
                        window.location.href="?c=Article&a=index";
                        $("#showMessage").hide(600);
                    }, 1000)
                })
            }
        }
    </script>
</head>

<body>
<!--导航栏-->
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="border">
    <tr class="topbg">
        <td>文章管理</td>
    </tr>
    <tr class="tdbg">
        <td height="30">&nbsp;&nbsp;
            <a href="?c=Article&a=index">管理首页</a>&nbsp;|&nbsp;
            <a href="?c=Article&a=add">添加文章</a>
        </td>
    </tr>
</table>

<!--搜索表单-->
<div id="commentSearch" style="padding:8px 5px;margin:8px 3px;background-color:#fefefe;text-align:center;">
    <form name="form1" method="post" action="?c=Article&a=index">
        <span style="padding:0px 5px;">分类</span>
        <select style="position: relative;height:22px;top:1.4px" name="category_id">
            <option value="">任意</option>
            <{foreach $categorys as $category}>
            <option value="<{$category.id}>">
                <{$category.classname}>
            </option>
            <{/foreach}>
        </select>
        <span style="padding:0px 5px;">标题</span>
        <input style="outline: none" type="text" name="keyword"/>
        <input id="commentBtn" type="submit" value="搜索"/>
    </form>
</div>

<!--文章列表-->
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="border">
    <tr class="title" align="center">
        <td>编号</td>
        <td>分类</td>
        <td>标题</td>
        <td>作者</td>
        <td>发布时间</td>
        <td>操作选项</td>
    </tr>
    <{foreach $articles as $article}>
    <tr class="tdbg" align="center">
        <td><{$article.id}></td>
        <td><{$article.classname}></td>
        <td align="left">
            <a target="_blank" href="#"><{$article.title}></a>
            <{if $article.top}>[<span style="color: red">顶</span>]<{/if}>
        </td>
        <td><{$article.username}></td>
        <td><{$article.addate|date_format:'%Y-%m-%d %H:%M:%S'}></td>
        <td>
            <a href="?c=Article&a=edit&id=<{$article.id}>">修改</a> |
            <a href="javascript:void(0)" onClick="confirmDel('<{$article.id}>')">删除</a>
        </td>
    </tr>
    <{/foreach}>
    <!--文章分页-->
    <tr class="tdbg">
        <td colspan="7" align="center"><{$pageStr}></td>
    </tr>
</table>
<!--  模态对话框-->
<div id="showMessage"><br>
    <div id="myToast">
        <div class="toast-header">
            <img src="./Public/Admin/Images/huaxin.png" alt="" width="30">
            <strong>提示</strong>
            <small>1分钟前</small>
            <button>&times;</button>
        </div>
        <div id="tipsMsg">
            注册成功！
        </div>
    </div>
</div>
<!--  模态对话框-->
</body>
</html>